#include<iostream.h> 
#include<iomanip.h>
#include<stdlib.h>
using namespace std;

int main()
{
    Array<int>    A(10);
    int n;
    int primecount = 0 ,i ,j;
    
    cout<<"Enter a value>=2 as upper limit for prime numbers :";
    cin>>n;
    A[primecount++]=2;//2 is prime
    for(i=3;i<=n/2;i++)
    {
        if(primecount==A.ListSize())     A.Resize(primecount+10) ;
        if(i%2==0)  continue;
        j=3;
        while(j<i/2&&i%j!=0) j+=2;
        if(j>i/2) A[primecount++]=i;
    }
    for(i=0;i<primecount;i++)
    {
        cout<<setw(5)<<A[i];
        if((i+1)%10==0) cout<<endl;
    }
    cout<<endl;
    system("pause");
    return 0;
}
